package o;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

public class cxz {
    private int ˊ;
    private Bitmap ˋ;
    private Context ˏ;
    private final int ॱ;

    private cxz(int i) {
        this.ॱ = i;
    }

    public static cxz ˏ(@NonNull Bitmap bitmap) {
        if (bitmap == null) {
            throw new NullPointerException("bitmap must not be null.");
        }
        cxz o_cxz = new cxz(1);
        o_cxz.ˋ = bitmap;
        return o_cxz;
    }

    @RequiresApi(23)
    @SuppressLint({"NewApi"})
    @NonNull
    public Icon ˋ() {
        switch (this.ॱ) {
            case 1:
                return Icon.createWithBitmap(this.ˋ);
            case 2:
                return Icon.createWithResource(this.ˏ, this.ˊ);
            default:
                throw new IllegalArgumentException("Unknown type");
        }
    }

    public void ˎ(@NonNull Intent intent) {
        ˏ(intent);
    }

    void ˏ(Intent intent) {
        switch (this.ॱ) {
            case 1:
                intent.putExtra("android.intent.extra.shortcut.ICON", this.ˋ);
                return;
            case 2:
                intent.putExtra("android.intent.extra.shortcut.ICON_RESOURCE", ShortcutIconResource.fromContext(this.ˏ, this.ˊ));
                return;
            default:
                throw new IllegalArgumentException("Icon type not supported for intent shortcuts");
        }
    }
}
